﻿<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:nRoute="clr-namespace:nRoute.Controls"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">

    <Style TargetType="nRoute:NavigationContentControl">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="0,0,0,0"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="nRoute:NavigationContentControl">
                    <Border x:Name="ClientArea"
						Background="{TemplateBinding Background}" 
						BorderBrush="{TemplateBinding BorderBrush}"  
				        BorderThickness="{TemplateBinding BorderThickness}" 
						OpacityMask="{TemplateBinding OpacityMask}"
						HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
						VerticalAlignment="{TemplateBinding VerticalAlignment}">

                        <!-- CONTENT -->
                        <ContentPresenter 
							Content="{TemplateBinding Content}"
							ContentTemplate="{TemplateBinding ContentTemplate}"
	                        Cursor="{TemplateBinding Cursor}"
	                        Margin="{TemplateBinding Padding}"
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
	                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="nRoute:NavigationContainer">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="0,0,0,0"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <!-- TEMPLATE-->
                <ControlTemplate TargetType="nRoute:NavigationContainer">
                    <Border x:Name="ClientArea"
						Background="{TemplateBinding Background}" 
						BorderBrush="{TemplateBinding BorderBrush}"  
				        BorderThickness="{TemplateBinding BorderThickness}" 
						OpacityMask="{TemplateBinding OpacityMask}"
						HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                        VerticalAlignment="{TemplateBinding VerticalAlignment}">

                        <!-- VSM RELATED -->
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="NavigationStates">

                                <!-- STATES -->
                                <vsm:VisualState x:Name="UnNavigated">
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="Navigating">
                                    <Storyboard RepeatBehavior="ForEver" BeginTime="00:00:00" AutoReverse="False" Duration="00:00:04.4">
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="IndicatorBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.0" Storyboard.TargetProperty="X" Storyboard.TargetName="R1TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.2" Storyboard.TargetProperty="X" Storyboard.TargetName="R2TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.4" Storyboard.TargetProperty="X" Storyboard.TargetName="R3TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.6" Storyboard.TargetProperty="X" Storyboard.TargetName="R4TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.8" Storyboard.TargetProperty="X" Storyboard.TargetName="R5TT">
                                            <LinearDoubleKeyFrame KeyTime="00:00:00.0" Value="0.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="33.1" EasingFunction="{StaticResource ProgressBarEaseOut}"/>
                                            <LinearDoubleKeyFrame KeyTime="00:00:02.0" Value="66.1"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:02.5" Value="100.1" EasingFunction="{StaticResource ProgressBarEaseIn}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R1">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.2" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R2">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.4" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R3">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.6" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R4">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.8" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="R5">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:02.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="Navigated">
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="NavigationFailed">
                                </vsm:VisualState>

                                <!-- TRANSITIONS -->
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00" To="NavigationFailed"/>
                                    <vsm:VisualTransition From="NavigationFailed" GeneratedDuration="00:00:00"/>
                                </vsm:VisualStateGroup.Transitions>

                            </vsm:VisualStateGroup>

                        </vsm:VisualStateManager.VisualStateGroups>

                        <!-- VISUALS -->
                        <Grid >

                            <!-- CONTENT -->
                            <ContentPresenter 
								Content="{TemplateBinding Content}"
								ContentTemplate="{TemplateBinding ContentTemplate}"
                            	Cursor="{TemplateBinding Cursor}"
                            	Margin="{TemplateBinding Padding}"
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                            <!-- NAVIGATING OVERLAY -->
                            <Border x:Name="IndicatorBorder" Background="#99000000" Visibility="Collapsed">
                                <Grid HorizontalAlignment="Left">
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R1" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R1TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R2" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R2TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R3" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R3TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R4" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R4TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Rectangle Fill="{TemplateBinding Foreground}" Height="4" IsHitTestVisible="False" Width="4" x:Name="R5" Opacity="0" CacheMode="BitmapCache">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="R5TT"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>